FROM golang:1.11.4 as basic

WORKDIR /go/src

ENV GO111MODULE=on
ENV GOPROXY="https://goproxy.io"

RUN GOOS=linux CGO_ENABLED=0 GOARCH=amd64
RUN  mkdir http && go mod init http
COPY ./main.go ./http/
RUN go build -o httpserver ./http/main.go && chmod +x /go/src/httpserver

FROM alpine

WORKDIR /

COPY --from=basic /go/src/httpserver /


RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
ENTRYPOINT ["./httpserver"]
